﻿
namespace OZDoo.Core.Caching
{
    /// <summary>
    /// 缓存接口
    /// </summary>
    public interface ICache
    {
        /// <summary>
        /// 清除缓存
        /// </summary>
        void Clear();
        /// <summary>
        /// 获得一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <returns></returns>
        object Get(string key);
        /// <summary>
        /// 插入一个缓冲
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        void Insert(string key, object obj);
        /// <summary>
        /// 插入一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="dep">关联</param>
        void Insert(string key, object obj, System.Web.Caching.CacheDependency dep);
        /// <summary>
        /// 插入一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="seconds">缓存时间</param>
        /// <param name="priority">相对优先级</param>
        void Insert(string key, object obj, int seconds, System.Web.Caching.CacheItemPriority priority);
        /// <summary>
        /// 插入一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="dep">关联</param>
        /// <param name="seconds">缓存时间</param>
        /// <param name="priority">相对优先级</param>
        void Insert(string key, object obj, System.Web.Caching.CacheDependency dep, int seconds, System.Web.Caching.CacheItemPriority priority);
        /// <summary>
        /// 插入一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="dep">关联</param>
        /// <param name="seconds">缓存时间</param>
        void Insert(string key, object obj, System.Web.Caching.CacheDependency dep, int seconds);
        /// <summary>
        /// 插入一个缓存值
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="seconds">缓存时间</param>
        void Insert(string key, object obj, int seconds);
        /// <summary>
        /// 插入一个缓存值,缓存时间最大化
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        void Max(string key, object obj);
        /// <summary>
        /// 插入一个缓存值,缓存时间最大化
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="dep">关联</param>
        void Max(string key, object obj, System.Web.Caching.CacheDependency dep);
        /// <summary>
        /// 插入一个缓存值,缓存时间短暂
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="secondFactor"></param>
        void MicroInsert(string key, object obj, int secondFactor);
        /// <summary>
        /// 插入一个缓存值,缓存时间恒定
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        /// <param name="dep">关联</param>
        void Permanent(string key, object obj, System.Web.Caching.CacheDependency dep);
        /// <summary>
        /// 插入一个缓存值,缓存时间恒定
        /// </summary>
        /// <param name="key">键值</param>
        /// <param name="obj">缓存值</param>
        void Permanent(string key, object obj);
        /// <summary>
        /// 删除一个缓存值
        /// </summary>
        /// <param name="key"></param>
        void Remove(string key);
        /// <summary>
        /// 输出符合条件的缓存值
        /// </summary>
        /// <param name="pattern">模式</param>
        void RemoveByPattern(string pattern);
        void ReSetFactor(int cacheFactor);
        int SecondFactorCalculate(int seconds);

        string[] GetAllCache();
    }
}
